//
//  MantisRightTextTableViewCell.m
//  NLProjectFrameworkDemo
//
//  Created by iosdeveloper on 2020/5/10.
//  Copyright © 2020 yj_zhang. All rights reserved.
//

#import "MantisRightTextTableViewCell.h"


@implementation MantisRightTextTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpView];
    }
    return self;
}

-(void)setUpView{
    [super setUpView];
}


-(void)reloadCellModel:(MantisCellBaseModel *)data{
    [super reloadCellModel:data];
    MantisTextCellData*newData=(MantisTextCellData*)data;
    self.cellBaseData=newData;
 
    CGSize labelSize =newData.contentSize;
    CGSize bgSize = CGSizeMake(labelSize.width+10, labelSize.height+10);
    
    [self setThreeCorner:bgSize bgView:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.avaterView.mas_left).offset(-adaptWidth750(20));
        make.top.equalTo(self.avaterView);
        make.size.mas_equalTo(bgSize);
    }];
 
   
    [self relayoutLabelSize:labelSize];//计算label宽高
    

    [self.errorBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.bgView.mas_left).offset(-adaptWidth750(20));
        make.centerY.equalTo(self.contentLabel);
    }];
    
    
    NSString*historyMsg=data.historyModel.msg;
    if (historyMsg.length>0) {

        if ([historyMsg containsString:@"src"]) {
            self.contentLabel.attributedText=newData.inputStr;

        }else{
            self.contentLabel.text=historyMsg;
        }
    }else
    {
       self.contentLabel.attributedText= newData.inputStr;
    }

   
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
